package com.mlk.engSystem.api;

import com.mlk.constant.OK;
import com.mlk.core.component.page.Pager;
import com.mlk.core.util.ServerResponse;
import com.mlk.engSystem.po.EngSysEmp;
import com.mlk.engSystem.po.EngSysEmpRemainApply;
import com.mlk.engSystem.service.EngSysEmpService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 业务员
 */
@RestController
@RequestMapping("/api/system/emp")
public class EngSystemEmpAPI {

    @Resource
    private EngSysEmpService engSysEmpService;

    /**
     * 校验用户是否已经认证过
     * @param openId
     * @return
     */
    @GetMapping("checkedIsRegistered")
    @OK
    public ServerResponse checkedIsRegistered(String openId){
        return this.engSysEmpService.checkedIsRegistered(openId);
    }


    /**
     * 业务员认证
     * @param emp
     * @return
     */
    // 参数 : 账号 密码 openid
    @PostMapping("empVerify")
    @OK
    public ServerResponse empVerify(EngSysEmp emp){
        return this.engSysEmpService.empVerify(emp);
    }

    /**
     * 业务员申请额度
     * 参数  openid amount 金额 原因
     * @return
     */
    @PostMapping("applyRemain")
    @OK
    public ServerResponse applyRemain(EngSysEmpRemainApply apply){
        return this.engSysEmpService.applyRemain(apply);
    }

    /**
     * 查询额度申请表
     * @return
     */
    @GetMapping("applyRemainList")
    @OK
    public Pager applyRemainList(String openId){
        return this.engSysEmpService.applyRemainList(openId);
    }

    /**
     * 查询权限余额
     * @param openId
     * @return
     */
    @GetMapping("queryMyRemain")
    @OK
    public ServerResponse queryMyRemain(String openId){
        return this.engSysEmpService.queryMyRemain(openId);
    }

    /**
     * 获取用户的信息
     * @return
     */
    @GetMapping("getEmpInfo")
    public ServerResponse getEmpInfo(String openId){
        return this.engSysEmpService.getEmpInfo(openId);
    }
}
